package com.cx.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.cx.entity.Comment;
import org.apache.ibatis.annotations.*;

import java.sql.Wrapper;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    @Select("select *from t_comment ${ew.customSqlSegment}")
    @Results({
            @Result(property = "articleId",column = "article_id"),
            @Result(property = "article",column = "article_id",
            one = @One(select = "com.cx.mapper.ArticleMapper.selectById"))
    })
    IPage<Comment> getCommentListAndArticlePageConditions(IPage page, @Param(Constants.WRAPPER) QueryWrapper wrapper);
}
